﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BestLifeEF
{
    public partial class reg_form : System.Web.UI.Page
    {
        #region Database connection

        DB.BestLifeDBDataContext db = new DB.BestLifeDBDataContext();// DB clz 1ke thiyana connection 1ka ta object 1k hadaagannawa db kiyala

        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void RadButton1_Click(object sender, EventArgs e)
        {
            try
            {
                DB.Tbl_Distributor distb = new DB.Tbl_Distributor(); // table 1ta object 1k hadaagannawa

                distb.Dis_ID = TextBoxDID.Text;
                distb.Sup_ID = TextBoxSDID.Text;
                distb.Fir_Name = TextBoxFN.Text;
                distb.Las_Name = TextBoxLN.Text;
                distb.Address = TextBoxAdd.Text;
                distb.Dob = RadDatePickerDOB.SelectedDate.Value.Date.ToString();
                distb.City = TextBoxCity.Text;
                distb.Country = ComboBoxCountry.SelectedValue.ToString();
                distb.Email = TextBoxEM.Text;
                distb.Sky_Add = TextBoxSKYPE.Text;
                distb.Tel_No = TextBoxMob.Text;
                distb.Fax = TextBoxFax.Text;
                distb.Off_Tel = TextBoxTOF.Text;
                distb.Use_Name = TextBoxUN.Text;
                distb.Pas_Word = TextBoxPW.Text;
                distb.User_Create = "Admin";
                distb.Date_Create = System.DateTime.Now;
                distb.Last_Modify = System.DateTime.Now;
                // distb.Key_Timestamp ="";
                db.Tbl_Distributors.InsertOnSubmit(distb); // insert query 1ka
                db.SubmitChanges();

                Label1.ForeColor = System.Drawing.Color.Green;
                Label1.Text = "Insert Success Yor Details Forward To Admin";
            }catch(Exception)
            {
                Label1.ForeColor = System.Drawing.Color.Red;
                Label1.Text = "Pls Retry Server Error";
            }
        }

     
    }
}